//=============================================================================
// COPYRIGHT:  OFS/BFS           SWITZERLAND
//=============================================================================
//
// $Workfile: CsvMunicipality.cs $
//
// PROJECT  : MetaStat Proto (GMF)
// VERSION  : 2.0
// CREATION : 05.03.2007
// AUTHOR   : P.Prati
//
// DETAIL   : Create a Municipality object from a CSV line
//
//-- REVISION -----------------------------------------------------------------
//
// $Revision: 1 $
// $Date: 1.03.08 16:42 $
// $Author: U4578 $
//
// $NoKeywords: $
//
//-----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;

namespace GeoPlugIn
{
    //------------------------------------------------------------------------
    #region Municipality CSV class

    public class CsvMunicipality : CsvMutation
    {
        public string NoHistoryDistrict;
        public string Status;

        private CsvDistrict parentDistrict;

        //Related district
        public CsvDistrict District
        {
            get { return parentDistrict; }
            set { parentDistrict = value; }
        }

        public CsvMunicipality(string csvRow)
            : base("Municipality", 15, csvRow)
        {
            int index = 0;

            // Fetch Info into properties
            NoHistory = Items[index++].Trim();
            NoHistoryDistrict = Items[index++].Trim();
            // Skip a canton abrev that is not in documentation but in file
            ++index;
            Code = Items[index++].Trim();
            OfficialTitle = Items[index++].Trim();
            ShortTitle = Items[index++].Trim();
            TypeRecord = Items[index++].Trim();
            Status = Items[index++].Trim();
            Inscription = new Mutation(Items[index].Trim(), Items[index+1].Trim(), Items[index+2].Trim());
            index += 3;
            Radiation = new Mutation(Items[index].Trim(), Items[index + 1].Trim(), Items[index + 2].Trim());
            index += 3;
            SysUpdateDt = Items[index++].Trim();

            //Clear no more usage
            Items = null;

        }
    }

    #endregion

}
